import os
import sys
sys.path.append('./')

import argparse
import matplotlib.pyplot as plt

import config as _C
from utils.contact_utils import parse_arduino_data

if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument('-s', '--sequence', default='')
    args = parser.parse_args()

    if args.sequence != '':
        _C.SEQUENCE_NAME = args.sequence

    contact_txt_path = os.path.join(_C.RAW_DATA_DIR, _C.SEQUENCE_NAME, "contact", "DATALOG.TXT")

    timestamps, readings = parse_arduino_data(contact_txt_path)
    
    hand_idxs = [14, 15]
    plt.plot(readings[:, hand_idxs])
    plt.show()

    check_idxss = [6, 7, 8, 9]
    for check_idxs in check_idxss:
        plt.plot(readings[:, check_idxs])
        plt.show()
